//
// Created by jaesonzhang on 2024/9/13.
//

#include "Canvas.h"

#include <utility>

namespace skiacanvas {

Canvas::Canvas(JSApp *app,
               skiacanvas::Context *ctx,
               int cId,
               int w,
               int h)
    : app(app), ctx(ctx), canvasId(cId), width(w),
      height(h) {

}

Canvas::~Canvas() {
  printf("release canvas\n");
}

void Canvas::commit() {
  if (ctx != nullptr) {
    app->requestRender(ctx->skBitmap, width, height);
  }
}

} // end of namespace skiacanvas

